<h2 class="pageTitle">Tasks rentability</h2>

<div class="menu-list">
    <form action="{$data.root}?input=tasks_rentability" method="post">

        <select size="1" name="period">
            {foreach $data.periods as $period}
                <option {if $period.period==$data.prefillPeriod}selected="selected"{/if} value="{$period.period}">{$period.period}</option>
            {/foreach}
        </select>
        <input value="Show" type="submit" />
    </form>
</div>

<table class="list">
    <tr>
        <th>Úloha - ukončená vo vybranom mesiaci</th>
        <th>Dátum vytvorenia</th>
        <th>Dátum ukončenia</th>
        <th>Klient</th>
        <th>Výnos</th>
        <th>Náklady</th>
        <th class="positionHandler">Rentabilita</th>
    </tr>
    {foreach $data.tasks as $key => $task}
        {if $task.break==1}
            <tr>
                <td colspan="7">&nbsp;</td>
            </tr>
            <tr>
                <th>Úloha - aktívna</th>
                <th>Dátum vytvorenia</th>
                <th>Dátum poslednej zmeny</th>
                <th>Klient</th>
                <th>Výnos</th>
                <th>Náklady</th>
                <th>Rentabilita</th>
            </tr>
        {/if}
        <tr>
            <td style="text-align: left"><a href="{$data.root}?input=edit_task&task={$task.taskId}" target="_blank">{$task.title}</a></td>
            <td>{$task.added_formated}</td>
            <td>{$task.updated_formated}</td>
            <td>{$task.client_info.fullName}</td>
            <td>{$task.revenue|round:"2"}</td>
            <td>{$task.expense|round:"2"}</td>
            {if $task.rentability !== '-'}
                <td {if $task.rentability < 1}style="color: red"{/if} onmouseout="hideRentabilityOverlay()" onmouseover="getRentabilityTablePerServismen({$task.taskId})">{$task.rentability|round:"2"}</td>
            {else}
                <td>{$task.rentability}</td>
            {/if}
        </tr>
    {/foreach}
</table>

<div id="rentOverlay">
    <div id="rentOverlayContent">
        
    </div>
</div>